/**
 * Created by RAZANERO on 3/02/14.
 */
function isNumeric(myfield, e, dec, frac) {
    var key;
    var keychar;
    if (window.event)
        key = window.event.keyCode; else if (e)
        key = e.which; else
        return true;
    keychar = String.fromCharCode(key);
    if ((key == null) || (key == 0) || (key == 8) || (key == 9) || (key == 27))
        return true; else if ((("0123456789").indexOf(keychar) > -1))
        return true; else if (keychar == ",") {
        return false;
    }
    else if (keychar == "-") {
        return  myfield.value.toString()=='';
    }
    else if (keychar == "+") {
        return  myfield.value.toString()=='';
    }
    else if (dec && (keychar == ".")) {
        return true;
    }
    else if (frac && keychar == "/") {
        return true;
    }else if (key == 13) {
        return false;
    } else return false;
}